package cn.itcast.controller;

import cn.itcast.pojo.*;
import cn.itcast.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService ;
    //根据性别统计员工人数
    @GetMapping("/empGenderData")
    public Result empGenderData(){
        List<EmpGender> result = reportService.empGenderData();

        return result != null ? Result.success(result) : Result.erro("查询失败");
    }
    //统计各职位有多少员工
    @GetMapping("/empJobData")
    public Result empJobData(){
        EmpJobData empJobData = reportService.empJobData();

        return empJobData == null ? Result.erro("查询失败") : Result.success(empJobData);
    }

    //统计各学位有多少人
    @GetMapping("/studentDegreeData")
    public Result studentDegreeData(){
        List<StudentDegreeData> studentDegreeData = reportService.studentDegreeData();

        return studentDegreeData == null ? Result.erro("查询失败") : Result.success(studentDegreeData);
    }
    //统计每个班有多少学员
    @GetMapping("/studentCountData")
    public Result studentCountData(){
        StudentCountData studentCountData = reportService.studentCountData();

        return studentCountData == null? Result.erro("查找失败") : Result.success(studentCountData);
    }

}
